package zuoye01;

import java.util.Scanner;


public class HomeWork {
	public static void main(String[] args) {
		if (checkHomework()) {
			System.out.println("作业提交成功");
		} else {
			System.out.println("作业提交失败");

		}
	}
	
	
	public static  boolean checkHomework() {
		System.out.println("-----欢迎来到作业提交系统-----");
		Scanner intput=new Scanner(System.in);
		System.out.println("请输入java文件名：");
		String name=intput.next();
		int index=name.lastIndexOf(".");
		if (index==-1) {
			System.out.println("文件名格式不对");
			return false;
		}
		String str=name.substring(index);
		if (!".java".equals(str)) {
			System.out.println("文件名格式不对");
			return false;
		}
		System.out.println("请输入邮箱：");
		String email=intput.next();
		index=email.indexOf("@");
		if (index<0) {
			System.out.println("email无效");
		}
		int index2=email.lastIndexOf(".");
		if (index2<index) {
			System.out.println("email无效");
			return false;
		}
		return true;
	}

}
